#include "message.h"
#include "ui_message.h"
#include "../mainwindow.h"

Message::Message(QMainWindow* parent) :
    message_parent(parent),
    ui(new Ui::Message)
{
    ui->setupUi(this);
}

Message::~Message()
{
    delete ui;
}

void Message::on_pushButton_2_clicked()
{
//    message_parent->
    QString name = this->ui->name->text();
    QString password = this->ui->password->text();
//    this->message_parent->query.exec("INSERT INTO Person (Name, Age) VALUES ('Alice', 30)");
    this->hide();
    MainWindow* parent = static_cast<MainWindow*>(message_parent);
    QSqlQuery query;
    query.exec("INSERT INTO users (name, password) VALUES ("+name+","+password+")");
//    query.exec("INSERT INTO Person (Name, Password) VALUES ("+name+" "+password+")");
    message_parent->show();


}

